home *** CD-ROM | disk | FTP | other *** search
/ Hráč 2005 January / Hrac_76_2005-01_dvd.iso / lokalizacie / Medal Of Honor Allied Assault / mohaa10cz.exe / {app} / main / Pak10.pk3 / Global / items.scr < prev    next >
Text File  |  2002-03-23  |  12KB  |  502 lines

  1. ////////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. //  MoH: Allied Assault Script File  
  4. //  Global function: For giving items and placing item icons on the HUD
  5. //  Script Written By: Benson 'elmagoo' Russell
  6. //
  7. ////////////////////////////////////////////////////////////////////////////////////////
  8.  
  9. //**************************************************************************
  10. //*** add items to inventory
  11. //*** this will put an item into the players inventory
  12. //*** syntax --------------------------------
  13. //*** add_item <item>
  14. //**************************************************************************
  15. add_item local.passed_item local.nomessage:
  16. //*** check to see if the counter has been initialized
  17. if (level.item_total == NIL)
  18. {
  19.     level.item_total = 0
  20. }
  21.  
  22. //*** check to see if there are already 6 items in the inventory
  23. if (level.item_total >= 6)
  24. {
  25.     println "^~^~^ Can't have more than 6 items in player's inventory!!"
  26.     goto add_item_end
  27. }
  28.  
  29. //*** assign the proper graphic for the item
  30. switch (local.passed_item)
  31. {
  32.     case "camera":
  33.         local.item_graphic = "textures/hud/item_camera"
  34.         local.item = "camera"
  35.         
  36.         if (local.nomessage == NIL)
  37.         {
  38.             iprintln "Ziskal jsi spionazni fotoaparat!"
  39.         }
  40.         
  41.         $player item models/items/camera.tik
  42.         break
  43.  
  44.     case "binoculars":
  45.         local.item_graphic = "textures/hud/item_binoculars"
  46.         local.pickup_sound = "pickup_explosives"
  47.         local.item = "binoculars"
  48.         
  49.         if (local.nomessage == NIL)
  50.         {
  51.             iprintln "Ziskal jsi dalekohled!"
  52.         }
  53.         
  54.         $player item models/items/binoculars.tik
  55.         break
  56.  
  57.     case "bangalores":
  58.         local.item_graphic = "textures/hud/item_bangalore"
  59.         local.pickup_sound = "pickup_bangalore"
  60.         local.item = "bangalores"
  61.         
  62.         if (local.nomessage == NIL)
  63.         {
  64.             iprintln "Ziskal jsi dlouhou naloz!"
  65.         }
  66.         
  67.         break
  68.  
  69.     case "battery":
  70.         local.item_graphic = "textures/hud/item_battery"
  71.         local.item = "battery"
  72.         
  73.         if (local.nomessage == NIL)
  74.         {
  75.             iprintln "Zskal jsi baterii!"
  76.         }
  77.         
  78.         break
  79.  
  80.     case "clipboard":
  81.         local.item_graphic = "textures/hud/item_clipboard"
  82.         //local.pickup_sound = "pickup_clipboard"
  83.         local.pickup_sound = "pickup_papers"
  84.         local.item = "clipboard"
  85.         
  86.         if (local.nomessage == NIL)
  87.         {
  88.             iprintln "Ziskal jsi prohlaseni!"
  89.         }
  90.         
  91.         break
  92.  
  93.     case "radar_blueprints":
  94.         local.item_graphic = "textures/hud/item_radar_blueprints"
  95.         local.pickup_sound = "pickup_papers"
  96.         local.item = "radar_blueprints"
  97.         
  98.         if (local.nomessage == NIL)
  99.         {
  100.             iprintln "Ziskal jsi tiskopis o radaru Naxos!"
  101.         }
  102.         
  103.         break
  104.  
  105.     case "radar_notes":
  106.         local.item_graphic = "textures/hud/item_radar_notes"
  107.         local.pickup_sound = "pickup_papers"
  108.         local.item = "radar_notes"
  109.         
  110.         if (local.nomessage == NIL)
  111.         {
  112.             iprintln "Ziskal jsi poznamky o vyzkumu radaru Naxos!"
  113.         }
  114.         
  115.         break
  116.  
  117.     case "uboat_blueprints":
  118.         local.item_graphic = "textures/hud/item_uboat_blueprints"
  119.         local.pickup_sound = "pickup_papers"
  120.         local.item = "uboat_blueprints"
  121.         
  122.         if (local.nomessage == NIL)
  123.         {
  124.             iprintln "Ziskal jsi tiskopisy o ponorce Naxos!"
  125.         }
  126.         
  127.         break
  128.  
  129.     case "uboat_notes":
  130.         local.item_graphic = "textures/hud/item_uboat_notes"
  131.         local.pickup_sound = "pickup_papers"
  132.         local.item = "uboat_notes"
  133.         
  134.         if (local.nomessage == NIL)
  135.         {
  136.             iprintln "Ziskal jsi poznamky vyzkumu o ponorce Naxos!"
  137.         }
  138.         
  139.         break
  140.  
  141.     case "explosive":
  142.         local.item = "explosive"
  143.  
  144.     case "explosives":
  145.         local.item_graphic = "textures/hud/item_explosive"
  146.         local.pickup_sound = "pickup_explosives"
  147.         if (local.item == NIL)
  148.         {
  149.             local.item = "explosives"
  150.         }
  151.         
  152.         if (local.nomessage == NIL)
  153.         {
  154.             iprintln "Ziskal jsi naloze!"
  155.         }
  156.         
  157.         break
  158.  
  159.     case "radio_explosives":
  160.         local.item_graphic = "textures/hud/item_radio_explosive"
  161.         local.pickup_sound = "pickup_explosives"
  162.         if (local.item == NIL)
  163.         {
  164.             local.item = "radio_explosives"
  165.         }
  166.         
  167.         if (local.nomessage == NIL)
  168.         {
  169.             iprintln "Ziskal jsi vybusne radiove naloze!"
  170.         }
  171.         
  172.         break
  173.  
  174.     case "gasmask":
  175.         local.item_graphic = "textures/hud/item_gasmask"
  176.         local.pickup_sound = "pickup_gasmask"
  177.         local.item = "gasmask"
  178.         
  179.         if (local.nomessage == NIL)
  180.         {
  181.             iprintln "Ziskal jsi plynovou masku!"
  182.         }
  183.         
  184.         break
  185.  
  186.     case "papers_level1":
  187.         local.item_graphic = "textures/hud/item_papers1"
  188.         local.pickup_sound = "pickup_papers"
  189.         local.item = "papers_level1"
  190.         $player item models/items/papers.tik
  191.         
  192.         if (local.nomessage == NIL)
  193.         {
  194.             iprintln "Ziskal jsi dokumenty 1 stupne!"
  195.         }
  196.         
  197.         level.papers = 1
  198.         break
  199.  
  200.     case "papers_level2":
  201.         local.item_graphic = "textures/hud/item_papers2"
  202.         local.pickup_sound = "pickup_papers"
  203.         local.item = "papers_level2"
  204.         $player item models/items/papers2.tik
  205.         
  206.         if (local.nomessage == NIL)
  207.         {
  208.             iprintln "Ziskal jsi dokumenty 2 stupne!"
  209.         }
  210.         
  211.         level.papers = 2
  212.         break
  213.  
  214.     case "wirecutters":
  215.         local.item = "wirecutters"
  216.  
  217.     case "wirecutter":
  218.         local.item = "wirecutter"
  219.  
  220.     case "cutters":
  221.         local.item = "cutters"
  222.  
  223.     case "cutter":
  224.         local.item_graphic = "textures/hud/item_wirecutters"
  225.         if (local.item == NIL)
  226.         {
  227.             local.item = "cutter"
  228.         }
  229.         
  230.         if (local.nomessage == NIL)
  231.         {
  232.             iprintln "Ziskal jsi nuzky na drat!"
  233.         }
  234.         
  235.         break
  236.  
  237.     case "radio":
  238.         local.item_graphic = "textures/hud/item_radio"
  239.         local.pickup_sound = "m3l2_radio_pickup"
  240.         local.item = "radio"
  241.         
  242.         if (local.nomessage == NIL)
  243.         {
  244.             iprintln "Ziskal jsi radio!"
  245.         }
  246.         
  247.         break
  248.  
  249.     case "uniform":
  250.         local.item_graphic = "textures/hud/item_uniform"
  251.         local.pickup_sound = "pickup_uniform"
  252.         local.item = "uniform"
  253.         
  254.         if (local.nomessage == NIL)
  255.         {
  256.             iprintln "Ziskal jsi Nemeckou dustojnickou uniformu!"
  257.         }
  258.         
  259.         $player.has_disguise = 1
  260.         setcvar g_playermodel "german_waffenss_officer"
  261.         break
  262.  
  263.     case "stg44_blueprints":
  264.         local.item_graphic = "textures/hud/item_stg44_blueprints"
  265.         local.pickup_sound = "pickup_papers"
  266.         local.item = "stg44_blueprints"
  267.         
  268.         if (local.nomessage == NIL)
  269.         {
  270.             iprintln "Ziskal jsi tiskopis o StG44!"
  271.         }
  272.         
  273.         break
  274.  
  275.     case "tigerii_manual":
  276.         local.item_graphic = "textures/hud/item_tigerii_manual"
  277.         local.pickup_sound = "pickup_papers"
  278.         local.item = "tigerii_manual"
  279.         
  280.         if (local.nomessage == NIL)
  281.         {
  282.             iprintln "Ziskal jsi prirucku k tanku King Tiger!"
  283.         }
  284.         
  285.         break        
  286.  
  287.     case "battleplans":
  288.         local.item_graphic = "textures/hud/item_battleplans"
  289.         local.pickup_sound = "pickup_papers"
  290.         local.item = "battleplans"
  291.         
  292.         if (local.nomessage == NIL)
  293.         {
  294.             iprintln "Ziskal jsi Nemecke bojove plany!"
  295.         }
  296.         
  297.         break        
  298.         
  299.     //*** the default is selected if the scripter enter a non-valid item
  300.     default:
  301.         println "^~^~^ " local.item " is not a valid inventory item!!"
  302.         goto add_item_end
  303.         break
  304. }
  305.  
  306. //*** up the item total counter
  307. level.item_total += 1
  308.  
  309. //*** shuffle the inventory items down 1 slot each
  310. for (local.i = level.item_total ; local.i > 1 ; local.i --)
  311. {
  312.     level.item_graphic[local.i] = level.item_graphic[(local.i - 1)]
  313.     level.item[local.i] = level.item[(local.i - 1)]
  314.     huddraw_shader (local.i + 20) level.item_graphic[local.i]
  315. }
  316.  
  317. //*** add the new item
  318. level.item_graphic[1] = local.item_graphic
  319. level.item[1] = local.item
  320. huddraw_shader 21 level.item_graphic[1]
  321.  
  322. //*** play the proper sound
  323. if (local.pickup_sound != NIL)
  324. {
  325.     $player playsound local.pickup_sound
  326. }
  327.  
  328. //*** draw the items on the screen
  329. thread draw_items
  330.  
  331. add_item_end:
  332. end
  333.  
  334.  
  335. //**************************************************************************
  336. //*** remove items from inventory
  337. //*** this will remove an item from the players inventory
  338. //*** syntax --------------------------------
  339. //*** remove_item <item>
  340. //**************************************************************************
  341. remove_item local.item:
  342. //*** check to see if the counter has been initialized
  343. if (level.item_total == NIL)
  344. {
  345.     level.item_total = 0
  346. }
  347.  
  348. //*** if the inventory is already empty, exit
  349. if(level.item_total <= 0)
  350. {
  351.     println "^~^~^ There are no items currently in the players inventory!!"
  352.     goto remove_item_end
  353. }
  354.  
  355. for (local.i = 1 ; local.i <= 6 ; local.i ++)
  356. {
  357.     if (level.item[local.i] == local.item)
  358.     {
  359.         local.index = local.i
  360.         goto remove_item_remove
  361.     }
  362. }
  363.  
  364. //*** if the item isn't in the players inventory tell the scripter
  365. println "^~^~^ " local.item " can not be removed, it is not in the players inventory!!"
  366. goto remove_item_end
  367.  
  368. //*** remove the item and shuffle the remaining inventory down a slot
  369. remove_item_remove:
  370.  
  371. //*** check to see if it's a useable item that needs removing
  372. if (local.item == "camera")
  373. {
  374.     $player take models/items/camera.tik
  375. }
  376. else if (local.item == "binoculars")
  377. {
  378.     $player take models/items/binoculars.tik
  379. }
  380. else if (local.item == "papers_level1")
  381. {
  382.     $player take models/items/papers.tik
  383.     level.papers = 0
  384. }
  385. else if (local.item == "papers_level2")
  386. {
  387.     $player take models/items/papers2.tik
  388.     level.papers = 0
  389. }
  390. else if (local.item == "uniform")
  391. {
  392.     setcvar g_playermodel "american_army"
  393.     $player.has_disguise = 0
  394. }
  395.  
  396. //*** remove the item and shuffle the rest down a slot
  397. for (local.j = local.index ; local.j < level.item_total ; local.j ++)
  398. {
  399.     
  400.     level.item_graphic[local.j] = level.item_graphic[(local.j + 1)]
  401.     level.item[local.j] = level.item[(local.j + 1)]
  402.     huddraw_shader (local.j + 20) level.item_graphic[local.j]
  403.  
  404.     level.item_graphic[(local.j + 1)] = ""
  405.     level.item[(local.j + 1)] = ""
  406. }
  407.  
  408. level.item_total -= 1
  409.  
  410. //*** draw the items on the screen
  411. thread draw_items
  412.  
  413. remove_item_end:
  414. end
  415.  
  416.  
  417.  
  418. //************************************************
  419. // draw the item icons
  420. //************************************************
  421. draw_items:
  422. //*** variables to base the position off of, positions for all the item slots
  423. /*
  424. local.xpos = -192
  425. local.ypos = 40
  426. */
  427. local.xpos = -384
  428. local.ypos = 8
  429.  
  430. huddraw_align 21 right top
  431. huddraw_align 22 right top
  432. huddraw_align 23 right top
  433. huddraw_align 24 right top
  434. huddraw_align 25 right top
  435. huddraw_align 26 right top
  436.  
  437. /*
  438. huddraw_rect 21 local.xpos local.ypos 30 30
  439. huddraw_rect 22 (local.xpos + 35) local.ypos 30 30
  440. huddraw_rect 23 (local.xpos + 70) local.ypos 30 30
  441. huddraw_rect 24 (local.xpos + 105) local.ypos 30 30
  442. huddraw_rect 25 (local.xpos + 140) local.ypos 30 30
  443. huddraw_rect 26 (local.xpos + 175) local.ypos 30 30
  444. */
  445. /*
  446. huddraw_rect 21 local.xpos local.ypos 64 64
  447. huddraw_rect 22 (local.xpos + 70) local.ypos 64 64
  448. huddraw_rect 23 (local.xpos + 140) local.ypos 64 64
  449. huddraw_rect 24 (local.xpos + 210) local.ypos 64 64
  450. huddraw_rect 25 (local.xpos + 280) local.ypos 64 64
  451. huddraw_rect 26 (local.xpos + 350) local.ypos 64 64
  452. */
  453.  
  454. //*** draw the items on the hud
  455. for (local.j = 1 ; local.j <= 6 ; local.j ++)
  456. {
  457.     local.xpos = -70 * local.j - 8
  458.     huddraw_rect (local.j + 20) local.xpos local.ypos 64 64
  459.  
  460.     if (local.j > level.item_total)
  461.     {
  462.         huddraw_alpha (local.j + 20) 0
  463.         goto draw_item_next
  464.     }
  465.  
  466.     huddraw_alpha (local.j + 20) 0.7
  467. draw_item_next:
  468. }
  469.  
  470. end
  471.  
  472.  
  473. //************************************************
  474. // reload all the item slots
  475. //************************************************
  476. reload_items:
  477.  
  478. waitthread blank_items
  479.  
  480. for (local.i = 1 ; local.i <= 6 ; local.i ++)
  481. {
  482.     huddraw_shader (local.i + 20) level.item_graphic[local.i]
  483. }
  484.  
  485. thread draw_items
  486.  
  487. end
  488.  
  489.  
  490. //************************************************
  491. // blank all the item slots
  492. //************************************************
  493. blank_items:
  494.  
  495. huddraw_alpha 21 0
  496. huddraw_alpha 22 0
  497. huddraw_alpha 23 0
  498. huddraw_alpha 24 0
  499. huddraw_alpha 25 0
  500. huddraw_alpha 26 0
  501.  
  502. end